/*
 * @Author: szx
 * @Date: 2022-03-29 13:53:04
 * @LastEditTime: 2022-03-29 14:40:27
 * @Description:
 * @FilePath: \leetcode\剑指offer\65\65.js
 */
/**
 * @param {number} a
 * @param {number} b
 * @return {number}
 */
var add = function (a, b) {
    while (b) {
        let carry = a & b; // 计算 进位
        a = a ^ b; // 计算 本位
        b = carry << 1;
        console.log(carry, a.toString(2), b.toString(2));
    }
    return a;
};

console.log(add(3, 6));
